package day06;

import java.util.Arrays;
import java.util.Random;

public class Demo02数组的复制 {
    public static void main(String[] args) {
        Random r = new Random();

        int[]arr=new int[5];
        int[]brr=new int[5];

        for (int i=0;i<5;i++){
            int num = r.nextInt(100);
            arr[i]=num;
        }
        System.out.println(Arrays.toString(arr));
        //arr:原数组
        //1:原数组的起始下标
        //brr:目标数组
        //0:目标数组的起始下标
        //4:要复制的元素个数
        System.arraycopy(arr,1,brr,0,2);
        System.out.println(Arrays.toString(brr));
    }
}
